<template>
  <div class="centent">
    <div class="header">
      <i class="icon-fanhui go_back" @click="goBack"></i>
      <p class="title" v-if="messageType == 0">系统消息</p>
      <p class="title" v-else-if="messageType == 2">新消息</p>
      <p class="title" v-else-if="messageType == 3">待处理邮件</p>
    </div>
    <div style="border-bottom: 1px solid #F3F3F3;padding: 0 21px">
      <div class="detail_item">
        <span class="label">发起人：</span>
        <span>{{senderName}}</span>
      </div>
      <div class="detail_item">
        <span class="label">时间：</span>
        <span>{{createTime}}</span>
      </div>
    </div>

    <div style="padding: 10px 21px">
      <p style="color: #435B77;font-size: 15px;font-weight: 600">内容</p>
      <div v-html="content"></div>
    </div>
  </div>
</template>

<script>
    import {messageDetail} from '@/api/message'

    export default {
        name: "detail",
        data() {
            return {
                senderName: '',
                createTime: '',
                content: '',
                messageType: ''
            }
        },
        created() {
            this.init()
        },
        methods: {
            goBack() {
                this.$router.go(-1)
            },
            init() {
                messageDetail(this.$route.params.id).then(res => {
                    if (res.data.success) {
                        this.messageType = res.data.data.messageType
                        this.senderName = res.data.data.senderName
                        this.createTime = res.data.data.createTime
                        this.content = res.data.data.content

                    }
                })
            }
        }
    }
</script>

<style scoped lang="scss">
  .header {
    display: flex;
    align-items: center;
    padding-bottom: 15px;

    .go_back {
      color: #2A97F9;
      font-size: 25px !important;
      cursor: pointer;
    }

    .title {
      font-size: 18px;
      font-weight: 600;
      color: #435B77;
    }
  }

  .label {
    display: inline-block;
    width: 54px;
  }

  .detail_item {
    line-height: 36px;
  }

  .centent {
    border-radius: 20px 20px 0 0;
    background-color: white;
    font-size: 13px;
    margin-top: 10px;
    margin-left: 10px;
  }
</style>
